<style>
.setimg{
	margin:-2px 5px 0 0 
}
</style>
<div class="row-fluid">
	<a style="border:1px solid #ccc" class="block-heading" data-toggle="collapse">列表数据</a>
    <div class="well">
	    <div class="btn-toolbar">
		    <form>
		    	<label style="display: inline;">用户名称：</label><input class="input input-medium" type="text" name="cust_name" value="<?=I('get.cust_name')?>" />
		    	<label style="display: inline;margin-left:10px">手机号码：</label><input class="input input-medium" type="text" name="cust_mobile" value="<?=I('get.cust_mobile')?>" />
		    	<input type="hidden" value="<?=I('get.res')?>" name="res" />
		    	<button class="btn btn-info" style="margin:-9px 0 0 15px"><i class="icon-search"></i> 搜索</button>
				<span class="btn btn-info lineCount_mri" style="float: right;padding: 2px 7px;">闺蜜用户等级</span>
				<span class="btn btn-info lineCount" style="margin:-61px -103px 0 15px;float: right;padding: 2px 7px;">用户等级</span>
		    </form>
		</div>
		<hr>
		<table class="table">
		      <thead>
		        <tr>
		          <th style="text-align:center;width:100px">序号id</th>
		          <th style="text-align:center;width:170px">用户姓名</th>
		          <th style="text-align:center;width:180px">手机号码</th>
                  <th style="text-align:center;width:180px">卡券总数</th>
		          <th style="text-align:center;width:180px">代理等级</th>
		          <th style="text-align:center;width:140px">操作时间</th>
		      	  <th style="text-align:center;width:130px">操作</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<?php if($getData){foreach($getData AS $key=>$val){ ?>
		        <tr> 
		          <td style="text-align:center;vertical-align:middle;"><?=$val['cust_id']?></td>
		          <td style="text-align:center;vertical-align:middle;">
                      <if condition="session('role_id') eq 1">
                      <a class="ifrm" href="javascript:void(0)" data-url="/index/user_info" data-width="680" data-height="430" data-title="卡券信息" data-params="cust_id/<?=$val['cust_id']?>"><?=$val['cust_realname'] ?: '-'?></a>
                      <else />
                          <a href="/order/index?cust_id=<?=$val['cust_id']?>"><?=$val['cust_realname'] ?: '-'?></a>
                      </if>
                  </td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['cust_mobile'] ?></td>
                    <td style="text-align:center;vertical-align:middle;">
                        <?php if($val['cust_cards']){foreach($val['cust_cards'] AS $k=>$v){ ?>
                        <span><?=$v['goods_title']. ' X ' .$v['nums']?></span><br/>
                        <?php }}else{?>
                        <span>无</span>
                        <?php }?>
                    </td>
                    <td style="text-align:center;vertical-align:middle;">
						<?php $getRmiTop = explode(',',getSysConfig('rmTop'));?>
						<?php if(!$val['rmauth'] && !in_array($val['cust_mobile'],$getRmiTop)){?>
						<span class="label label-default">无权限</span>
						<?php }elseif($val['rmauth'] == 1 && $val['parent_rmi_id']){?>
						<span class="label label-warning" style="background-color:#93D6CD">闰蜜会员</span>
						<?php }elseif(in_array($val['cust_mobile'],$getRmiTop)){?>
						<span class="label label-info" style="background-color:#B387CA">顶级</span>
						<?php }?>
		          </td>
		          <td style="text-align:center;vertical-align:middle;"><p>注册时间：<?=date('Y-m-d H:i',$val['add_at'])?></p><p>升级时间：<?=$val['success_at'] > 0 ? date('Y-m-d H:i',$val['success_at']) : '- -'?></p></td>
		          <td style="text-align:center;vertical-align:middle;">
		              <a class="ifrm btn btn-info" href="javascript:void(0)" data-url="/index/addcust" style="display:none;padding: 0px 4px;" data-width="680" data-height="430" data-title="修改信息" data-params="cust_id/<?=$val['cust_id']?>"><i class="icon-pencil"></i></a>&nbsp;&nbsp;
		              <?php if($val['check']){?>
					  	  <a href="/index/decate?custid=<?=$val['cust_id']?>&m=CustEntity" class="decate btn btn-danger" style="padding: 0px 4px;" role="button" title="冻结用户" data-toggle="modal"><i class="icon-eye-close"></i></a>&nbsp;&nbsp;
					  <?php }else{ ?>
					      <a href="/index/decate?custid=<?=$val['cust_id']?>&types=1&m=CustEntity" class="decate btn btn-warning" style="padding: 0px 4px;" role="button" title="解封用户" data-toggle="modal"><i class="icon-eye-open"></i></a>&nbsp;&nbsp;
					  <?php }?>
					  <?php if($val['salelevel'] && session('role_id') == 1){?>
                      <a class="ifrm btn btn-info" href="javascript:void(0)" data-url="/index/add_card" style="padding: 0px 4px;" data-width="680" data-height="430" data-title="添加卡券" data-params="cust_id/<?=$val['cust_id']?>"><i style="font-style: normal" class="icon-add">+卡券</i></a>&nbsp;&nbsp;
                      <a class="btn decate" href="/index/del_Usercard?cust_id=<?=$val['cust_id']?>" title="清除所有卡券"><i style="font-style: normal; color: red">一键清除</i></a>&nbsp;&nbsp;
                      <?php }?>
				 </td>
		        </tr>
		        <?php }}else{?>
		        	<tr><td style="text-align:center" colspan=7>暂无数据</td></tr>
		        <?php }?>
		      </tbody>
		   </table>
		   <span style="float:right;margin-top:-44px"><?=$page?></span>
	</div>
</div>
<script>
$(function(){
	$('#setApply').change(function(){
		if($(this).val() != '0'){
			var strs = <?=json_encode($jsonArr)?>;
			var html = '<select name="city" id="appCity" style="width:125px;margin-left:5px">';
			for(var i=0;i<strs[$(this).val()].length;i++){
				html += '<option value="'+strs[$(this).val()][i]['city']+'">'+strs[$(this).val()][i]['city']+'('+strs[$(this).val()][i]['cnt']+')</option>';
			}
			html += '</select>';
			$('#appCity').remove();
			$(html).insertAfter($('#setApply'));
			<?php if(I('get.city')){?>
			$('#appCity').val('<?=I('get.city')?>');
			<?php }?>
		}
	}).trigger('change');
	$('.decate').live('click',function(){
		if(!window.confirm('确认'+$(this).attr('title')+'吗 ? (注意:一键清除后若要恢复需联系管理员)')){
			return false;
		}
		window.location = $(this).attr('href');
	});
	$('.setTag').click(function(){
		if(!window.confirm('确认'+$(this).attr('title')+'吗 ?')){
			return false;
		}
		window.location = $(this).attr('href');
	});
	$('.lineCount').click(function(){
        art.dialog.open('/user/level/ifm/1/',
        {
            id: 'SETCHOSEID',
            width: '100%',
            height: '100%',
            left: '0%',
            top: '0%',
            fixed: true,
            resize: false,
            drag: false,
            title: '用户等级'
        });
    });
    $('.lineCount_mri').click(function(){
        art.dialog.open('/user/mlevel/ifm/1/',
            {
                id: 'SETCHOSEID',
                width: '100%',
                height: '100%',
                left: '0%',
                top: '0%',
                fixed: true,
                resize: false,
                drag: false,
                title: '闺蜜用户等级'
            });
    });
})
</script>